﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace LED_Tester
{
    public partial class frmLumenType : Form
    {
        //增加辐射强度分布测量的波长范围选项------------------------------2016-08-29
        public double Wavelength1;
        public double Wavelength2;

        public frmLumenType()
        {
            InitializeComponent();
        }

        private int lumenType; 

        public int LumenType
        {
            get { return lumenType; }
            set { lumenType = value; }
        }


        private void button1_Click(object sender, EventArgs e)
        {
            //增加辐射强度分布测量的波长范围选项------------------------------2016-08-29
            double tmp;
            if (!double.TryParse(textBox1.Text, out tmp)   //判断是否为数字
                || !double.TryParse(textBox2.Text, out tmp)
                || double.Parse(textBox1.Text) < 380 || double.Parse(textBox1.Text) > 830
                || double.Parse(textBox1.Text) < 380 || double.Parse(textBox2.Text) > 830
                || double.Parse(textBox1.Text) > double.Parse(textBox2.Text))
            {
                MessageBox.Show("请输入正确数值！", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            try
            {
                Wavelength1 = double.Parse(textBox1.Text);
                Wavelength2 = double.Parse(textBox2.Text);
                //this.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("请输入正确数值！", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            this.Close();

            DialogResult = DialogResult.OK;

            if (radioButton1.Checked == true)
            {
                lumenType = 1;
            }

            if (radioButton2.Checked == true)
            {
                lumenType = 2;
            }
        }

        private void frmLumenType_Load(object sender, EventArgs e)
        {

        }

        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {
            textBox1.Enabled = false;
            textBox2.Enabled = false;
        }

        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {
            textBox1.Enabled = true;
            textBox2.Enabled = true;
        }




    }


}
